<template>
  <div>
    <!-- header -->
    <top-head :user="user" @loginOut="loginOut"></top-head>
    <!-- aside -->
    <left-aside :navList="navList"  @openSecond="openSecond"></left-aside>
    <!-- main -->
    <router-view class="main" :key="$route.path"></router-view>
  </div>
</template>
<script>
import TopHead from "../../components/content/layout/Head.vue";
import LeftAside from "../../components/content/layout/Aside.vue";

export default {
  components: {
    TopHead,
    LeftAside
  },
  data() {
    return {
      user: {
        title: "教师后台管理系统",
        userIconPath:"http://picture.amdox.com.cn/static/defaultPhoto.png",
        userName:"admin"
      },
      navList: [
        {
          name: "基础数据",
          isList: true,
          path: "/baseData",
          icon:'base',
          list: [
            { name: "分类管理", path: "/category/list" },
            { name: "标签管理", path: "/tag/list" },
            { name: "栏目管理", path: "/type/list" },
          ]
        },
        {
          name: "内容管理",
          isList: false,
          path: "/section",
          icon:"section",
          list: [
            { name: "文章列表", path: "/section/article" },
            { name: "视频列表", path: "/section/video" }
          ]
        },
        {
          name: "运营管理",
          isList: false,
          path: "/operate",
          icon:"operate",
          list: [
            { name: "广告位管理", path: "/operate/ad" },
            { name: "评论管理", path: "/operate/comment" },

          ]
        },
        {
          name: "系统管理",
          isList: false,
          path: "/admin",
          icon:"admin",
          list: [
            { name: "用户管理", path: "/admin/user" },
            { name: "角色管理", path: "/admin/role" },
            { name: "我的资料", path: "/admin/profile" }
          ]
        }
      ]
    };
  },
  methods:{
    openSecond(nav, index) {
      this.navList[index].isList = !this.navList[index].isList;
    },
    loginOut(){
      this.$router.push('/login')
    }
  }
};
</script>
<style lang="scss" scoped>
.main{
    position: fixed;
    top: 88px;
    left: 240px;
    width: 100%;
    height: 100%;
}
</style>